#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@author: lyndon
@time Created on 2018/12/7 14:43
@desc
"""

import os
import configparser

from analyzer.core.EsTools import EsTool

SECRET_KEY = 'ty@puton.info'

config = configparser.ConfigParser()

config_path = r'%s\%s' % (os.path.dirname(os.path.abspath(__file__)), 'config.ini')
user_timeout = 10
user_db_path = r'%s\%s' % (os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'db')

config.read(config_path)
imgdir = config['DEFAULT']['img_dir']
# print(imgdir)
ttffile = config['DEFAULT']['ttf_dir']
# print(ttffile)
es_ips = config['DEFAULT']['es_ips']
es_ips = [i.strip() for i in es_ips.split(',')]
server_port = config['DEFAULT']['serv_port']


# print(es_ips)
# print(type(es_ips))

est = EsTool(hosts=es_ips, timeout=5000)

if __name__ == '__main__':
    print(config_path)
    print(user_timeout)
    print(user_db_path)
    print(imgdir)
    est = EsTool(hosts=es_ips, timeout=5000)
    est.init_es(index_name='tb_phone_url', doc_type_name='_doc')

